package com.example.back.mapper;

import com.example.back.model.Boardgame;
import com.example.back.model.PsGame;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PsGameMapper {
    @Select("select * from ps_game")
    List<PsGame> findAllPsGame();
    @Select("select * from ps_game where concat(name, introduction, yuyan, type) like concat('%', #{information}, '%')")
    List<PsGame> findByInformation(String information);
    @Select("select * from ps_game order by score desc")
    List<PsGame> findAllPsGameByScore();
    @Select("select * from ps_game where type=#{type}")
    List<PsGame> searchPType(String type);
    @Select("select * from ps_game where instr(name, #{name})>0")
    List<PsGame> selectPName(String name);
    @Insert("insert into ps_game(name, introduction, lan, type, score) values(#{name}, #{introduction}, #{yuyan}, #{type}, #{score})")
    Boolean insertPsGame(String name, String introduction, String yuyan, String type, double score);
    @Update("update ps_game set yuyan=#{yuyan} where id=#{id}")
    Boolean updateYuyanByID(int id, String yuyan);
    @Update("update ps_game set score=#{score} where id=#{id}")
    Boolean updateScoreByID(int id, double score);
    @Delete("delete from ps_game where id=#{id}")
    Boolean deletePsGame(int id);
    @Select("select photo from ps_game where id=#{id}")
    String findPhotoByID(int id);
}
